package net.lzzy.practicesapi1.entities;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author dzh
 */
@Entity
@Getter
@Setter
public class Chapter extends BaseEntity {
    private String name;
    private String description;
    private boolean open;
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;
    @ManyToOne
    private Course course;

    @OneToMany
    private List<Question> questionList = new ArrayList<>();

    public Chapter() {
        createTime = new Date();
        updateTime = createTime;
    }

}
